#include "vroute_sys.hpp"
#include "vrouteErrors.hpp"
#include "vroute_localDeviceInfo.hpp"
#include "stackProtocol.hpp"
#include "vroute_tools.hpp"

namespace vroute_stack
{
    NodeAddr CLocalDevInfo::m_localAddr;

    const unsigned char* CLocalDevInfo::getLocalAddrChars()
    {
        return m_localAddr.caddr;
    }

    bool CLocalDevInfo::IsLocalPacket(const NodeAddr& addr)
    {
        return addr.addr == m_localAddr.addr;
    }

    void CLocalDevInfo::setLocalAddr(const char* caddr, int len)
    {
        if (15 != len)
        {
            return;
        }
        unsigned long long _tmp = vos_atoll(caddr);
        m_localAddr.addr = CTools::getCompAddr((char*)&_tmp);
    }

    NodeAddr CLocalDevInfo::getLocalAddr()
    {
        return m_localAddr;
    }
}
